<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
	<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/apply.css" source="widget" />
	<script src="${ctx}/js/controllers/coupon/CouponApplyController.js" type="text/javascript"></script>
          <div style="top:130px;position:fixed;height:30px;font-size: 14px;font-family: '微软雅黑';margin-left:-236px;">
				当前位置：${sessionScope.currcent_position}
          </div>
          <section>
                <!--begin 搜索栏 -->
                  <div class="panel" style="margin-top:16px;">
                  <div class="forword_area"></div>
					<div class="location">添加优惠券</div>
					</div>
	                   <div id="form" class="form" style="min-height:300px;border: 1px solid #e6e6e6;">
								   <%-- <div class="itemEdit" style="border-top:1px solid #e6e6e6;">
								        <input id="infocellid" type="hidden" value="${couponInfo.cellId }">
		                                <span class="col-sm-1 editlableDetail" style="font-size:14px;">小区名<em class="emStyle">*</em>&nbsp;：</span>
		                                <div class="fldetail-4l" >
		                                <select id="cellid" style="height: 29px;" required>
		                                <option value=''>--请选择小区--</option>
			                             <c:forEach items="${cellinfos}" var="item" varStatus="cStatus">
										 <option value="${item.id}"  <c:if test="${item.id == cellId}">selected="selected"</c:if>>${item.cellName}</option>
								        </c:forEach>
		                                </select>
		                              
		                              </div>
								        <input id="infoshopid" type="hidden" value="${couponInfo.shopId }">
		                                <span class="col-sm-1 editlableDetail" style="font-size:14px;">店铺名<em class="emStyle">*</em>&nbsp;：</span>
		                               <div class="fldetail-4r">
		                                <select id="shopid" style="height: 29px;" required>
		                                <option value=''>--请选择店铺--</option>
			                             <c:forEach items="${shopinfos}" var="item" varStatus="cStatus">
										 <option value="${item.id}"  <c:if test="${item.id == shopId}">selected="selected"</c:if>>${item.name}</option>
								        </c:forEach>
		                                </select>
		                              </div>
		                            </div> --%>
									<div class="itemEdit">
										 <span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>优惠券名称：</span>
										 <div class="fldetail-4l" >
										    <input id="couponInfoId" type="hidden" value="${couponInfo.id}">
											<input class="controlEdit" id="name" type="text" value="${couponInfo.name}" 
											 onblur="checkName()" style="width:100%;margin-left: -40px" class="text" maxlength="20" />
										</div>
										<span class="col-sm-1 editlableDetail" style="font-size:14px;margin-left: 70px;"><em class="emStyle">*</em>数量&nbsp;：</span>
										<div class="fldetail-4r" >
											<input class="controlEdit" id="count" type="text" style="width:111%;margin-left:-77px"  
											 onblur="checkCount()" maxlength="11" value="${couponInfo.count}">
										</div>
									</div>
									<div class="itemEdit">
										<span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>领取有效期：</span>
										<div class="fldetail-4l" >
											 <input class="controlEdit" style="width:43.5%;margin-left:-40px" id="beginDate" type="text" maxlength="11" class="input-sm" 
											 onblur="checkBeginDate()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'useBeginDate\')}'})" 
											 value="${couponInfo.beginDate}" >
										     <span style="margin-left:3px;margin-right:3px;font-family: 微软雅黑;font-size: 14px;">至</span>
											 <input class="controlEdit" style="width:43.5%" id="endDate" type="text" maxlength="11" class="input-sm" 
											 onblur="checkEndDate()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'useEndDate\')}',startDate:'#F{$dp.$D(\'beginDate\',{d:+1})}'})" 
											 value="${couponInfo.endDate}" >
										</div>
										<span class="col-sm-1 editlableDetail" style="font-size:14px;margin-left: 70px"><em class="emStyle">*</em>使用有效期：</span>
										<div class="fldetail-4r" >
											 <input class="controlEdit" style="width:39%;margin-left:-40px" id="useBeginDate" type="text" maxlength="11" class="input-sm" 
											 onblur="checkUseBeginDate()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'beginDate\')}',startDate:'#F{$dp.$D(\'beginDate\',{d:+1})}'})" 
											 value="${couponInfo.useBeginDate}" >
										     <span style="margin-left:3px;margin-right:3px;font-family: 微软雅黑;font-size: 14px;">至</span>
											 <input class="controlEdit" style="width:39%" id="useEndDate" type="text" maxlength="11" class="input-sm" 
											 onblur="checkUseEndDate()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'useBeginDate\')}',startDate:'#F{$dp.$D(\'useBeginDate\',{d:+1})}'})" 
											 value="${couponInfo.useEndDate}" >
										</div>
									</div>
									<div class="itemEdit">
										<span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>优惠券金额：</span>
										<div class="fldetail-4l" >
										<span style="margin-left:-30px;margin-right:3px;font-family: 微软雅黑;font-size: 14px;">满</span>
										 <input class="controlEdit" style="width:37%;margin-left:-1px" id="breakLine" type="text" maxlength="10"
										 onblur="checkBreakLine()" class="input-sm" value="${couponInfo.breakLine}" >
										     <span style="margin-left:3px;margin-right:3px;font-family: 微软雅黑;font-size: 14px;">减</span>
										<input class="controlEdit" style="width:38%" id="breakPrice" type="text" maxlength="11" 
										 onblur="checkBreakPrice()" class="input-sm" value="${couponInfo.breakPrice}" >
										</div>
									</div>
										

					</div>
							<div class="foot">
							<div>
								<div style="float:left;padding-left:40%;padding-top:19px">
									<button class="buttonEdit" onclick="saveCouponInfo();">添&nbsp;&nbsp;加</button>
								</div>
								<div style="float:left;margin-left:2%;padding-top:19px">
									<button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
								</div>
								</div>
							</div>
				
              </section>
		<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
	</script>
	
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
